import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import axios from "axios";
import VueAxios from "vue-axios";
import "./styles/index.scss";

import "lib-flexible/flexible";

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";

import VueCoreVideoPlayer from "vue-core-video-player";

import VueLazyLoad from "vue-lazyload";

Vue.use(VueLazyLoad, {
  // 图片懒加载效果
  // v-lazy=" 图片路径item.picUrl"   v-lazy  代替  :src

  preLoad: 1,
  // error: require('./assets/img/error.jpg'),
  // loading: require('./assets/img/homePage_top.jpg'),
  attempt: 2,
});

Vue.use(VueCoreVideoPlayer);
Vue.use(ElementUI);
Vue.use(VueAxios, axios);

// 播放时间过滤
Vue.filter("playTime", (v) => {
  if (typeof v === "string") {
    return v;
  }
  let time = Math.floor(v);

  let m, s;
  m = Math.floor((time % 3600) / 60);
  s = Math.floor(time % 60);

  m = m < 10 ? "0" + m : m;
  s = s < 10 ? "0" + s : s;
  return m + ":" + s;
});

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
